#pragma once
#include "Character.h"
#include "Color.h"
using namespace std;

class CharacterDrawer
{
	public:
		CharacterDrawer(int aTileSize);
		~CharacterDrawer();

		void Draw(Character* aCharacter);

	private:
		int tileSize;
		int& s;
		Color color;

		ALLEGRO_BITMAP* arm;
		ALLEGRO_BITMAP* leg;
		ALLEGRO_BITMAP* body;
		ALLEGRO_BITMAP* head;
		ALLEGRO_BITMAP* hand;
		ALLEGRO_BITMAP* foot;
		ALLEGRO_BITMAP* dress;

		ALLEGRO_BITMAP* hairBuf;
		ALLEGRO_BITMAP* hairBuf2;

		Character* actualCharacter;
		vector<ALLEGRO_COLOR> characterColorSet;
		vector<ALLEGRO_COLOR> characterColorSetB;
		vector<ALLEGRO_COLOR> hairColorSet;
		vector<ALLEGRO_COLOR> hairColorSetB;
		ALLEGRO_COLOR characterColor;
		ALLEGRO_COLOR characterColorB;
		ALLEGRO_COLOR skinColorSet;
		ALLEGRO_COLOR skinColor;
		ALLEGRO_COLOR skinColorB;

		void DrawSkeleton(Bone* aBone, int aBaseX, int aBaseY);

		void GenerateCharacterColor();
		void GetRandomClothColor(ALLEGRO_COLOR& aCol, ALLEGRO_COLOR& aColB);

		void GetHairColor(ALLEGRO_COLOR& aCol, ALLEGRO_COLOR& aColB);

		void GenerateCharacterSkinColor();

		void RenderArm();
		void RenderLeg();
		void RenderBody();
		void RenderHead();
		void RenderHand();
		void RenderFoot();
		void RenderDress();

		void DrawLeftArm();
		void DrawRightArm();
		void DrawLeftLeg();
		void DrawRightLeg();

		int positionX;
		int positionY;
		Bone* leftArm;
		Bone* rightArm;
		Bone* leftLeg;
		Bone* rightLeg;
};

